﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace RungSoft.RungEBookMaker.Providers.DocFormater.Umd
{
    internal class ChapterBMList : CollectionBase
    {
        // Methods
        internal int Add(ChapterBM chapter)
        {
            return base.List.Add(chapter);
        }

        internal int IndexOf(string title)
        {
            for (int i = 0; i < base.List.Count; i++)
            {
                if (this[i].Title == title)
                {
                    return i;
                }
            }
            return -1;
        }

        internal void Insert(int index, ChapterBM chapter)
        {
            base.List.Insert(index, chapter);
        }

        internal void Remove(string title)
        {
            int index = this.IndexOf(title);
            if (index != -1)
            {
                base.RemoveAt(index);
            }
        }

        // Properties
        internal ChapterBM this[int index]
        {
            get
            {
                return (ChapterBM)base.List[index];
            }
            set
            {
                base.List[index] = value;
            }
        }
    }
}
